<template>
  <el-container class="component-map-container" v-if="isMapShow">
    <abbr-map :mapInfo="mapInfo"></abbr-map>
  </el-container>
</template>

<script>
import AbbrMap from '@/components/AbbrMap'
import {findCruise} from '@/http/WangGeGuanLiApi'
import {getUserGridTree} from '@/utils/SessionDataUtil'
export default {
  data () {
    return {
      mapInfo: null,
      isMapShow: false
    }
  },
  components: {
    AbbrMap
  },
  mounted () {
    this.getGridTree()
  },
  methods: {
    getCruise () {
      findCruise().then(resp => {
        if (resp.code && resp.code === '200') {
          this.mapInfo.isLoadMarker = true
          this.mapInfo.markerInfo = {
            markerData: resp.data
          }
          this.isMapShow = true
        }
      })
    },
    getGridTree () {
      let treeData = getUserGridTree()
      this.mapInfo = {
        isPrism: true,
        isLoadPolygon: true,
        isZoomChangedEvt: true,
        viewMode: '3D',
        polygonInfo: {
          treeData: treeData
        }
      }
      this.getCruise()
    }
  }
}
</script>

<style>
.component-map-container{
  width: 100%;
  height: 100%;
}
</style>
